package com.dz.annotation;


import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

public class AnnotationDemo04 {
    public static void main(String[] args) {
        Person person = new Person(100);

        Class cls = person.getClass();
        // 反射所有属性
        Field[] declaredFields = cls.getDeclaredFields();
        for (Field field : declaredFields) {
            F annotation = field.getAnnotation(F.class);
            int max = annotation.max();
            int min = annotation.min();
            String desc = annotation.desc();
            if (person.getAge() > max || person.getAge() < min) {
                System.out.println(desc);
            }

        }

    }
}
